﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using common;
using System.Globalization;
using System.Resources;
namespace GTVAccountingSystem.view.usercontrol
{
    public partial class frmAuditLogPreview : Form
    {
        uclAuditlog auditLog;
        ResourceManager rm = Constant.RM;
        CultureInfo culture = Constant.CULTURE;
        public frmAuditLogPreview(uclAuditlog auditLog)
        {
            this.auditLog = auditLog;
            InitializeComponent();
            this.Text = Constant.RM.GetString("frmAuditLogPreview", Constant.CULTURE);
            ReportDocument rptDoc = new ReportDocument();
            rptDoc.FileName = "reportGTVAccountingSystem\\AuditLogReport.rpt";
            report.dsAuditLog ds = new report.dsAuditLog();
            ds.Tables[0].Merge(auditLog.dt);
            rptDoc.SetDataSource(ds);
            rptDoc.SetParameterValue("CompanyName", rm.GetString("lblCompanyName", culture) + " : GTV");
            rptDoc.SetParameterValue("TaxCode", rm.GetString("lblTaxCode", culture) + " : 123456789");
            rptDoc.SetParameterValue("Address", rm.GetString("lblAddress", culture) + " : 163 Trần Huy Liệu Q.Phú Nhuận");
            rptDoc.SetParameterValue("CompanyPhone", rm.GetString("lblPhone", culture) + " : 0123456789 - 9876543210");
            rptDoc.SetParameterValue("employee", rm.GetString("lblUsername", culture) + Constant.USER_INFORMATIONDTO.FirstName);
            rptDoc.SetParameterValue("employeePhone", rm.GetString("lblPhone", culture) + Constant.USER_INFORMATIONDTO.Phone1);
            rptDoc.SetParameterValue("employeeEmail", rm.GetString("lblEmail", culture) + Constant.USER_INFORMATIONDTO.Email);
            rptDoc.SetParameterValue("Username", rm.GetString("lblUsername", culture));
            rptDoc.SetParameterValue("LogDate", rm.GetString("lblLogDate", culture));
            rptDoc.SetParameterValue("LogTime", rm.GetString("lblLogTime", culture));
            rptDoc.SetParameterValue("Actions", rm.GetString("lblActions", culture));
            rptDoc.SetParameterValue("Contents", rm.GetString("lblContents", culture));
            rptDoc.SetParameterValue("Date", DateTime.Now.ToShortDateString());
            crptViewerAuditLog.ReportSource = rptDoc;
        }

        private void frmPreviewAuditLog_FormClosing(object sender, FormClosingEventArgs e)
        {
           
        }
    }
}
